package com.han.observer.jdk_observer;

import java.util.Observable;

/**
 * @ClassName Stock
 * @Description 被观察者
 * @Author duoduo Han
 * @Date 2024/6/17 13:07
 */
public class Stock extends Observable {
    private String data;

    public String getData() {
        return data;
    }

    public Stock(String data){
        this.data = data;
    }
    public void changeData(String data){
        this.data = data;
        super.setChanged();//changed=true
        super.notifyObservers();//通知观察者执行update方法
    }

}
